<template>
	<div>
		<el-form ref="form" :model="form" label-width="80px">
		    <el-form-item label="内容">
				<edit ref="myEdit" />
			</el-form-item>
			<el-form-item label="状态">
			  <el-radio-group ref="radio" v-model="form.status">
				<el-radio label="0">禁用</el-radio>
				<el-radio label="1">启用</el-radio>
			  </el-radio-group>
			</el-form-item>
			<el-form-item label="排序">
				<el-input size="mini"
					type="number"
					v-model="form.sort"></el-input>
			</el-form-item>
			<el-form-item >
			  <el-button type="primary" @click="confirm" size="small">确定</el-button>
		    </el-form-item>
		</el-form>
		
		
	</div>
</template>

<script>
	import edit from '@/components/wangEditor'
	export default {
		components:{
			edit
		},
		props:{
			formDD:{
				type:Object,
				default:{}
			}
		},
		mounted() {
			// 获取到带有aria-hidden属性的元素
			  const ariaEls = this.$refs.radio.$el.querySelectorAll('input[type="radio"]')
			  if (!ariaEls) return
			  ariaEls.forEach((item) => {
			    // aria-hidden属性
			    item.removeAttribute('aria-hidden');
			  });
			setTimeout(()=>{
				if(this.formDD.content){
					// window.$editor.txt.html(this.formDD.content)
					this.$refs.myEdit.html = this.formDD.content
				}else{
					// window.$editor.txt.html()
					this.$refs.myEdit.html = ''
					
				}
				this.form.status = this.formDD.status
				this.form.sort = this.formDD.sort
			},100)
		},
		data(){
			return {
				isShow:false,
				form:{
					content:'',
					status:'1',
					sort:1
				}
			}
		},
		methods:{
			confirm(){
				let params = {
					// content: window.$editor.txt.html(),
					content: this.$refs.myEdit.html,
					status:this.form.status,
					sort:this.form.sort,
					cid:sessionStorage.getItem('cid')
				}
				this.$emit('getFormVal',params)
			},
		}
	}
</script>

<style>
	
</style>